package com.redside.webapp.util;

import java.beans.PropertyEditorSupport;

import com.redside.model.lookup.BusinessCatLkp;
import com.redside.service.OptionsBeanLookupManager;

public class CustomBusinessCategoryEditor  extends PropertyEditorSupport {
 
    private final OptionsBeanLookupManager optionsBeanManager;
 
    public CustomBusinessCategoryEditor(OptionsBeanLookupManager optionsBeanLookupDao) {
        this.optionsBeanManager = optionsBeanLookupDao;
    }
 
    @Override
    public void setAsText(String text) throws IllegalArgumentException {
    	//TODO fix to get value from text field
    	BusinessCatLkp lkp = new BusinessCatLkp(Long.valueOf(1), "Pub");
        setValue(lkp);
    }
 
    @Override
    public String getAsText() {
    	BusinessCatLkp s = (BusinessCatLkp) getValue();
        if (s == null) {
            return null;
        } else {
            return s.getId().toString();
        }
    }
}